package com.text.day1_2;

import java.util.Random;
import java.util.Scanner;

public class ZuoYePrice {
    public static void main(String[] args) {
        Random random = new Random();
//        double pri = random.nextDouble() * 8000 + 2000;
//        System.out.println(pri);
        int pri = random.nextInt(8000) + 2000;  // 设为整数
        System.out.println(pri);
        int count = 1;
        int guess;
        Scanner scanner = new Scanner(System.in);
        while (count <= 5){
            System.out.println("输入价格。(2000-10000之间)");
            guess = scanner.nextInt();
            count++;
            if(guess == pri){
                System.out.println("恭喜你，获得了此奖品。");
                count = 7;
            }
        }
        if (count != 7)
            System.out.println("很可惜，你没有获得奖品，竞猜结束。");
    }
}
